package reflect;

import java.lang.reflect.Method;
import java.lang.reflect.Modifier;

public class test
{
    public static void main(String[] args) throws Exception
    {
        Class p = Class.forName("reflect.Person");
        Object person = p.newInstance();
        Method[] methods = p.getMethods();
        for (Method method : methods)
        {
            if (method.getModifiers() == Modifier.PUBLIC && method.getParameterCount() == 0 )
            {
                method.invoke(person);
            }
        }
    }
}
